<?php
error_reporting(0);
session_start();
include_once '../comm/config.php';
include_once '../comm/checkpostandget.php';
include_once 'check.php';
include_once 'page.class.php';
include_once '../comm/wjt.php';

$keyword=$_GET["keyword"]; 
$act=$_GET['act'];
$page = !($_GET['page'])?'1':intval($_GET['page']);
$pagesize=10;
$page2=($page-1)*$pagesize;

if (!$act) {
	echo "缺少必要参数";
	exit;
}
else
{
	if($act=='in'){
		$sql="select * from ".$BIAOTOU."mingxi where (je>0 or jifen>0) and shijian<>'兑换成功' and shijian<>'兑换失败' and ddusername='".$_SESSION["duoduouser"]."'";
		$rs = mysql_query($sql);
		$total = mysql_num_rows($rs);	
		$sql="select * from ".$BIAOTOU."mingxi where (je>0 or jifen>0) and shijian<>'兑换成功' and shijian<>'兑换失败' and ddusername='".$_SESSION["duoduouser"]."' order by addtime desc limit $page2,$pagesize";
		$rs = mysql_query($sql);
	}
	elseif($act=='tui'){
		$sql="select * from ".$BIAOTOU."mingxi where je<0 and ddusername='".$_SESSION["duoduouser"]."'";
		$rs = mysql_query($sql);
		$total = mysql_num_rows($rs);	
		$sql="select * from ".$BIAOTOU."mingxi where je<0  and ddusername='".$_SESSION["duoduouser"]."' order by addtime desc limit $page2,$pagesize";
		$rs = mysql_query($sql);
	}
	elseif($act=='out'){
		$sql="select * from ".$BIAOTOU."tixian where ddusername='".$_SESSION["duoduouser"]."'";
		$rs = mysql_query($sql);
		$total = mysql_num_rows($rs);	
		$sql="select * from ".$BIAOTOU."tixian where ddusername='".$_SESSION["duoduouser"]."' order by addtime desc limit $page2,$pagesize";
		$rs = mysql_query($sql);
	}
}

$tag="center";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>我的账户明细 - 用户中</title>

<link href="../template/<?=MOBAN?>/css/style.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/layout.css" rel="stylesheet" type="text/css" />
<link  href="../template/<?=MOBAN?>/css/comm.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.layout_body table td{border-bottom:#f1f1f1 solid 1px}
</style>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<?php
$modtag="mng";
include("../template/".MOBAN."/header_user.tpl.php");
?>
<div class='layout_body'>

  <div class="uInfoTop">
     <div class="break"><a href="javascript:void();" onclick="javascript:window.history.back();"><img src="../template/<?=MOBAN?>/images/back.gif" width="29" height="30" border="0" /></a></div>
     <div class="username usernamefont"><?=$_SESSION["duoduouser"]?></div>
     <div class="userstate"><a class="ustatefont" href="exit.php">退出</a></div>
  </div>
  <div class="usertopline"></div>

  <div class="clears"></div>
  <div class="CreatL">
    <ul>
      <li class="UserSel"><a href="mingxilist.php?act=in">账户明细</a></li>
      <li><a href="avatar.php"> 头像设置</a></li>
      <li><a href="setpass.php">密码设置</a></li>
      <li><a href="info.php">个人信息设置</a></li>
    </ul>
  </div>

  <div class="CreatR">
    <ul class="babydetail MarginB10">
      <li <?php if($act=='in') echo "class=\"active\"";?>><a href="mingxilist.php?act=in">我的收入明细</a></li>
      <li <?php if($act=='tui') echo "class=\"active\"";?>><a href="mingxilist.php?act=tui">我的退款明细</a></li>
      <li <?php if($act=='out') echo "class=\"active\"";?>><a href="mingxilist.php?act=out">我的提现明细</a></li>
      <li><a href="tixian.php">申请提现</a></li>
    </ul>
    <div class="clears"></div>
    <div class=" clears"></div>
    
    <div align="right">
		<?php if($act=='in'){?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
          <td width="20%" height="35" align="left" bgcolor="#f5f5f5">收入事件</td>
          <td width="50%" align="left" bgcolor="#f5f5f5">收入说明</td>
          <td width="10%" align="left" bgcolor="#f5f5f5">金额/米</td>
          <td width="20%" align="left" bgcolor="#f5f5f5">时间</td>
        </tr>
        <?php while ($row = mysql_fetch_array($rs)){?>
        <tr>
          <td width="20%" height="40" align="left"><?=$row["shijian"]?></td>
          <td width="50%" align="left"><?=$row["memo"]?></td>
          <td width="10%" align="left"><?=$row["je"]*100?></td>
          <td width="20%" align="left"><?=date("Y-m-d h:i:s",strtotime($row["addtime"]))?></td>
        </tr>
        <?php }}?>
        </table>
       
        <?php if($act=='tui'){?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
          <td width="20%" height="35" align="left" bgcolor="#f5f5f5">退款事件</td>
          <td width="50%" align="left" bgcolor="#f5f5f5">退款说明</td>
          <td width="10%" align="left" bgcolor="#f5f5f5">金额/米</td>
          <td width="20%" align="left" bgcolor="#f5f5f5">时间</td>
        </tr>
        <?php while ($row = mysql_fetch_array($rs)){?>
        <tr>
          <td width="20%" height="40" align="left"><?=$row["shijian"]?></td>
          <td width="50%" align="left"><?=$row["memo"]?></td>
          <td width="10%" align="center"><?=$row["je"]*100?></td>
          <td width="20%" align="left"><?=date("Y-m-d",strtotime($row["addtime"]))?></td>
        </tr>
        <?php }}?>
        </table>
      
        <?php if($act=='out'){?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
          <td width="20%" height="35" align="left" bgcolor="#f5f5f5">收款支付宝</td>
          <td width="20%" align="left" bgcolor="#f5f5f5">提现金额</td>
          <td width="20%" align="left" bgcolor="#f5f5f5">提现状态</td>
          <td width="20%" align="left" bgcolor="#f5f5f5">提现IP</td>
          <td width="20%" align="left" bgcolor="#f5f5f5">提现时间</td>
        </tr>
        <?php while ($row = mysql_fetch_array($rs))
		{
			if($row["txstate"]=='0'){
				$txs="<font color=#dd0000>处理中...</font>";
			}elseif($row["txstate"]=='1'){
				$txs="<font color=#009900>提现成功</font>";
			}else{
				$txs="<font color=#333333>提现失败</font>";
			}
		?>
        <tr>
          <td width="20%" height="40" align="left"><?=$row["zfb"]?></td>
          <td width="20%" align="left"><?=$row["txje"]?></td>
          <td width="20%" align="left"><?=$txs?></td>
          <td width="20%" align="left"><?=$row["addip"]?></td>
          <td width="20%" align="left"><?=date("Y-m-d",strtotime($row["addtime"]))?></td>
        </tr>
        <?php }}?>
       </table>
     <div class="megas512" style="clear:both"><?php pageft($total,$pagesize,1,1,0,10,"mingxilist.php?act=".$act."");	echo $pagenav;?></div>
    </div>
    <div class="clears"></div>
  </div>
  <div class="clears"></div>
</div>

<div class="lineclear" style="margin-top:50px"></div>
<?php
include("../template/".MOBAN."/footer.tpl.php");
?>
</body>
</html>
